import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import autoprefixer from 'autoprefixer';
import { resolve } from 'path';
import removeConsole from 'vite-plugin-remove-console';
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons';
import legacy from '@vitejs/plugin-legacy' 


// https://vitejs.dev/config/
export default defineConfig({
	base: './',
	plugins: [
		vue(),
		removeConsole(),
		createSvgIconsPlugin({
			// 指定要缓存的图标文件夹
			iconDirs: [resolve(process.cwd(), 'src/assets/svg')],
			// 执行icon name的格式
			symbolId: 'icon-[dir]-[name]',
		}),
		legacy({ 
			targets: ['Chrome 64'], 
			modernPolyfills: true 
		}),
	],
	server: {
		host: '0.0.0.0',
		port: 9001,
		https: false,
	},
	define: {

	},
	resolve: {
		alias: {
			'@': resolve(__dirname, 'src')
		},
	},
	css: {
		postcss: {
			plugins: [
				autoprefixer
			],
		},
		preprocessorOptions: {
			scss: {
				additionalData: '' //全局引入
			}
		}
	},
	build: {
        
	}
})
